package com.saftalk.ui;

import java.util.Date;

import com.saftalk.db.entity.User;

public class UIPresenceResult extends UIResult {

	private final String name;
	private final Long userId;
	private final String photoId;
	private final boolean isSenior;
	private Long lastSeen;
	private boolean isOnline;
	
	
	
	public UIPresenceResult(User u)
	{
		this.name = u.getName();
		this.userId = u.getId();
		this.photoId = u.getPhotoId();
		this.isSenior = u.isSenior();
		this.isOnline = false;
		this.lastSeen = 0L;
	}
	public UIPresenceResult(UIUserResult u)
	{
		this.name = u.getName();
		this.userId = u.getUserId();
		this.photoId = u.getPhotoId();
		this.isSenior = u.isSenior();
		this.isOnline = false;
		this.lastSeen = 0L;
	}
	
	public String getName() {
		return name;
	}

	public Long getUserId() {
		return userId;
	}

	public String getPhotoId() {
		return photoId;
	}
	
	public boolean isOnline() {
		return isOnline;
	}
	
	public boolean isSenior() {
		return isSenior;
	}
	
	public Long getLastSeen() {
		return lastSeen;
	}
	
	public void see() {
		this.lastSeen = (new Date()).getTime();
		this.isOnline = true;
	}
	public void offline() {
		this.isOnline = false;
	}
	
}
